-- double_reel
-- create by wangy
-- 概率获得双倍卷轴

return {
    apply = function(prop, baseValue)
        -- 数值
        return prop[3];
    end,

    -- 触发
    trigger = function(who, prop, arg)
        if not arg then
            return 0;
        end

        if type(arg[2]) ~= "number" or type(arg[3]) ~= "number" then
            return 0;
        end

        -- 概率之外
        if DungeonM.getRandSeed("double_reel") % 1000 >= tonumber(prop[3]) then
            return 0;
        end

        -- 是否阶位小于要求
        local classId = arg[2];
        local rank = SpellM.query(classId, "rank");
        if rank > tonumber(prop[2]) then
            return 0;
        end

        return arg[3];
    end,

    record = function(target, prop, path)
        return false;
    end
};
